<!DOCTYPE html>
<html lang="en" class="app">
<head>
<title>Category Management | <?php echo SITENAME; ?></title>
<meta name="description" content="" />
<?php fnGetHeader(); ?>
</head>
<body>
<?php fnGetSidebar(); ?>
<section id="content">
  <section class="vbox">
    <section class="scrollable padder">
      <div class="m-b-md"> <?php echo @$this->noti; ?>
        <h3 class="m-b-none"><?php if(GET('action')=='edit'){ echo 'Edit'; } else { echo 'Add';} ?> Category</h3>
      </div>
      <div class="row">
        <div class="col-sm-12">
         
              <?php if(GET('action')=="add" || GET('action')=="edit"){ ?>
               <section class="panel panel-default">
            <header class="panel-heading font-bold">Category</header>
            <div class="panel-body">
              <form class="bs-example form-horizontal" method="post" enctype="multipart/form-data">
                <div class="form-group">
                  <label class="col-lg-2 control-label">Name</label>
                  <div class="col-lg-10">
                    <input class="form-control" placeholder="Category Name" name="cat_name" type="text" value="<?php if(GET('editUid')) { echo stripslashes($this->editrow['cat_name']); } ?>" required>
                  </div>
                </div>
                  <div class="form-group">
                          <label class="col-lg-2 control-label">Status</label>
                          <div class="col-lg-10">
                              <select required="" id="cat_status" class="form-control" name="cat_status">
                                  <option value="">--Select Status--</option>
                                  <option value="1" <?php if(GET('editUid')) { if($this->editrow['cat_status']==1){?> selected <?php } } ?>>Active</option>
                                  <option value="0" <?php if(GET('editUid')) { if($this->editrow['cat_status']==0){?> selected <?php } } ?>>Inactive</option>
                              </select>
                          </div>
                      </div>
                
               
                <!---- Button -->
                <div class="form-group">
                  <div class="col-lg-offset-2 control-label col-lg-10">
                  <?php if(GET('editUid')) { echo '<input type="hidden" name="editUid" value="'.GET('editUid').'">'; }?>
                    <button type="submit" name="submit" value="Submit" class="btn btn-s-md btn-primary ">
					<?php if(GET('editUid')) { echo 'Update'; } else { echo "Create"; }?>
                    </button>
                  </div>
                </div>
              </form>
                </div>
          </section>
        </div>
      </div>

              <?php }
				  else {
				  ?>
                  
              <section class="panel panel-default">
                <header class="panel-heading"> All Categories </header>
                <div class="row text-sm wrapper">
                 <form action="" method="get">
                  <div class="col-sm-3">
                    <div class="input-group">
                      <input class="input-sm form-control" placeholder="Search" name="q" type="text">
                      <span class="input-group-btn">
                      <input type="hidden" name="action" value="view">
                      <button class="btn btn-sm btn-default" type="submit" name="search" value="search">Go!</button>
                      </span> </div>
                  </div>
                  </form>
                </div>
                 <form action="" method="post">
                <div class="table-responsive">
                  <table class="table table-striped b-t b-light text-sm">
                    <thead>
                      <tr>
                        <th width="20"><input type="checkbox"></th>
                        <th class="th-sortable" data-toggle="class">Category </th>
                        <th>Last Modify</th>
                        <th>Modify By</th>
                        <th width="60"></th>
                      </tr>
                    </thead>
                    <tbody>
                    <?php  ?>
                     <?php 
                     if(count($this->PagingNationFetch) > 0){
                     foreach($this->PagingNationFetch as $PagingNationFetch){ ?>
                     <tr>
                        <td><input name="cat_id[]" value="<?php echo $PagingNationFetch['cat_id'] ?>" type="checkbox"></td>
                        <td><?php echo stripslashes($PagingNationFetch['cat_name']) ?></td>
                        <td><?php echo $PagingNationFetch['cat_updatedate'] ?></td>
                        <td><?php echo getAdmin($PagingNationFetch['LastModifyBy']); ?></td>
                        <td><a href="<?php echo URL ?>newcategory/?action=edit&editUid=<?php echo $PagingNationFetch['cat_id'] ?>"><i class="fa fa-edit"></i></a>
                        <!--<a href="<?php echo SITEURL ?><?php echo $PagingNationFetch['cat_alias'] ?>" target="_blank"><i class="fa fa-eye"></i></a>
                        -->
                        </td>
                      </tr>
                      <?php }
                     }else{ ?>
                      <tr>
                          <td colspan="5" style="text-align: center"><b>No Record Found</b></td>
                      </tr>
                      <?php }?>
                    
                      
                       
                    </tbody>
                  </table>
                </div>
                <footer class="panel-footer">
                  <div class="row">
                    <div class="col-sm-4 hidden-xs">
                      
                      <button type="submit" name="delete" onClick="return confirm('Are you sure to delete?');" class="btn btn-sm btn-default">Delete</button>
                    </div>
                 
                    <div class="col-sm-8 text-right text-center-xs">
                        <?php
			echo pagination($this->statement,$this->limit,$this->page,'?',$this->oldData);
?>
                    </div>
                  
                  </div>
                </footer>
                </form>
              </section>
            
              <?php } ?>
              </section>
  </section>
</section>
<?php fnGetFooter(); ?>
<!-- file input --> <script src="<?php echo TEMPLATE; ?>js/file-input/bootstrap-filestyle.min.js" cache="false"></script>
<script src="//tinymce.cachefly.net/4.0/tinymce.min.js"></script>

<script>
function GetKeyword()
{
    $("#searchTags").val($("#keywords").val());
}
</script>
</body>
</html>